/*
 * An XML document type.
 * Localname: script
 * Namespace: urn:jbpm.org:jpdl-3.2
 * Java type: x2.orgJpdl3.jbpm.ScriptDocument
 *
 * Automatically generated - do not modify.
 */
package x2.orgJpdl3.jbpm.impl;
/**
 * A document containing one script(@urn:jbpm.org:jpdl-3.2) element.
 *
 * This is a complex type.
 */
public class ScriptDocumentImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements x2.orgJpdl3.jbpm.ScriptDocument
{
    private static final long serialVersionUID = 1L;
    
    public ScriptDocumentImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName SCRIPT$0 = 
        new javax.xml.namespace.QName("urn:jbpm.org:jpdl-3.2", "script");
    
    
    /**
     * Gets the "script" element
     */
    public x2.orgJpdl3.jbpm.ScriptDocument.Script getScript()
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.ScriptDocument.Script target = null;
            target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().find_element_user(SCRIPT$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }
    
    /**
     * Sets the "script" element
     */
    public void setScript(x2.orgJpdl3.jbpm.ScriptDocument.Script script)
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.ScriptDocument.Script target = null;
            target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().find_element_user(SCRIPT$0, 0);
            if (target == null)
            {
                target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().add_element_user(SCRIPT$0);
            }
            target.set(script);
        }
    }
    
    /**
     * Appends and returns a new empty "script" element
     */
    public x2.orgJpdl3.jbpm.ScriptDocument.Script addNewScript()
    {
        synchronized (monitor())
        {
            check_orphaned();
            x2.orgJpdl3.jbpm.ScriptDocument.Script target = null;
            target = (x2.orgJpdl3.jbpm.ScriptDocument.Script)get_store().add_element_user(SCRIPT$0);
            return target;
        }
    }
    /**
     * An XML script(@urn:jbpm.org:jpdl-3.2).
     *
     * This is a complex type.
     */
    public static class ScriptImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements x2.orgJpdl3.jbpm.ScriptDocument.Script
    {
        private static final long serialVersionUID = 1L;
        
        public ScriptImpl(org.apache.xmlbeans.SchemaType sType)
        {
            super(sType);
        }
        
        private static final javax.xml.namespace.QName NAME$0 = 
            new javax.xml.namespace.QName("", "name");
        private static final javax.xml.namespace.QName ACCEPTPROPAGATEDEVENTS$2 = 
            new javax.xml.namespace.QName("", "accept-propagated-events");
        
        
        /**
         * Gets the "name" attribute
         */
        public java.lang.String getName()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$0);
                if (target == null)
                {
                    return null;
                }
                return target.getStringValue();
            }
        }
        
        /**
         * Gets (as xml) the "name" attribute
         */
        public org.apache.xmlbeans.XmlString xgetName()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlString target = null;
                target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$0);
                return target;
            }
        }
        
        /**
         * True if has "name" attribute
         */
        public boolean isSetName()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().find_attribute_user(NAME$0) != null;
            }
        }
        
        /**
         * Sets the "name" attribute
         */
        public void setName(java.lang.String name)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(NAME$0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(NAME$0);
                }
                target.setStringValue(name);
            }
        }
        
        /**
         * Sets (as xml) the "name" attribute
         */
        public void xsetName(org.apache.xmlbeans.XmlString name)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.XmlString target = null;
                target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(NAME$0);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(NAME$0);
                }
                target.set(name);
            }
        }
        
        /**
         * Unsets the "name" attribute
         */
        public void unsetName()
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_attribute(NAME$0);
            }
        }
        
        /**
         * Gets the "accept-propagated-events" attribute
         */
        public x2.orgJpdl3.jbpm.BooleanType.Enum getAcceptPropagatedEvents()
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ACCEPTPROPAGATEDEVENTS$2);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_default_attribute_value(ACCEPTPROPAGATEDEVENTS$2);
                }
                if (target == null)
                {
                    return null;
                }
                return (x2.orgJpdl3.jbpm.BooleanType.Enum)target.getEnumValue();
            }
        }
        
        /**
         * Gets (as xml) the "accept-propagated-events" attribute
         */
        public x2.orgJpdl3.jbpm.BooleanType xgetAcceptPropagatedEvents()
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.BooleanType target = null;
                target = (x2.orgJpdl3.jbpm.BooleanType)get_store().find_attribute_user(ACCEPTPROPAGATEDEVENTS$2);
                if (target == null)
                {
                    target = (x2.orgJpdl3.jbpm.BooleanType)get_default_attribute_value(ACCEPTPROPAGATEDEVENTS$2);
                }
                return target;
            }
        }
        
        /**
         * True if has "accept-propagated-events" attribute
         */
        public boolean isSetAcceptPropagatedEvents()
        {
            synchronized (monitor())
            {
                check_orphaned();
                return get_store().find_attribute_user(ACCEPTPROPAGATEDEVENTS$2) != null;
            }
        }
        
        /**
         * Sets the "accept-propagated-events" attribute
         */
        public void setAcceptPropagatedEvents(x2.orgJpdl3.jbpm.BooleanType.Enum acceptPropagatedEvents)
        {
            synchronized (monitor())
            {
                check_orphaned();
                org.apache.xmlbeans.SimpleValue target = null;
                target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(ACCEPTPROPAGATEDEVENTS$2);
                if (target == null)
                {
                    target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(ACCEPTPROPAGATEDEVENTS$2);
                }
                target.setEnumValue(acceptPropagatedEvents);
            }
        }
        
        /**
         * Sets (as xml) the "accept-propagated-events" attribute
         */
        public void xsetAcceptPropagatedEvents(x2.orgJpdl3.jbpm.BooleanType acceptPropagatedEvents)
        {
            synchronized (monitor())
            {
                check_orphaned();
                x2.orgJpdl3.jbpm.BooleanType target = null;
                target = (x2.orgJpdl3.jbpm.BooleanType)get_store().find_attribute_user(ACCEPTPROPAGATEDEVENTS$2);
                if (target == null)
                {
                    target = (x2.orgJpdl3.jbpm.BooleanType)get_store().add_attribute_user(ACCEPTPROPAGATEDEVENTS$2);
                }
                target.set(acceptPropagatedEvents);
            }
        }
        
        /**
         * Unsets the "accept-propagated-events" attribute
         */
        public void unsetAcceptPropagatedEvents()
        {
            synchronized (monitor())
            {
                check_orphaned();
                get_store().remove_attribute(ACCEPTPROPAGATEDEVENTS$2);
            }
        }
    }
}
